Optimal. Leaf size=172 \[ \frac{b^2 \left (3 a^2 B+3 a A b-b^2 B\right ) \tan (c+d x)}{d}-\frac{b \left (6 a^2 A b+4 a^3 B-4 a b^2 B-A b^3\right ) \log (\cos (c+d x))}{d}+x \left (4 a^3 A b-6 a^2 b^2 B+a^4 B-4 a A b^3+b^4 B\right )+\frac{a^4 A \log (\sin (c+d x))}{d}+\frac{b (2 a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac{b B (a+b \tan (c+d x))^3}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.47066, antiderivative size = 172, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 29, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.172, Rules used = {3607, 3647, 3637, 3624, 3475} \[ \frac{b^2 \left (3 a^2 B+3 a A b-b^2 B\right ) \tan (c+d x)}{d}-\frac{b \left (6 a^2 A b+4 a^3 B-4 a b^2 B-A b^3\right ) \log (\cos (c+d x))}{d}+x \left (4 a^3 A b-6 a^2 b^2 B+a^4 B-4 a A b^3+b^4 B\right )+\frac{a^4 A \log (\sin (c+d x))}{d}+\frac{b (2 a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac{b B (a+b \tan (c+d x))^3}{3 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3607
Rule 3647
Rule 3637
Rule 3624
Rule 3475
Rubi steps
\begin{align*} \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx &=\frac{b B (a+b \tan (c+d x))^3}{3 d}+\frac{1}{3} \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (3 a^2 A+3 \left (2 a A b+a^2 B-b^2 B\right ) \tan (c+d x)+3 b (A b+2 a B) \tan ^2(c+d x)\right ) \, dx\\ &=\frac{b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac{b B (a+b \tan (c+d x))^3}{3 d}+\frac{1}{6} \int \cot (c+d x) (a+b \tan (c+d x)) \left (6 a^3 A+6 \left (3 a^2 A b-A b^3+a^3 B-3 a b^2 B\right ) \tan (c+d x)+6 b \left (3 a A b+3 a^2 B-b^2 B\right ) \tan ^2(c+d x)\right ) \, dx\\ &=\frac{b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac{b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac{b B (a+b \tan (c+d x))^3}{3 d}-\frac{1}{6} \int \cot (c+d x) \left (-6 a^4 A-6 \left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) \tan (c+d x)-6 b \left (6 a^2 A b-A b^3+4 a^3 B-4 a b^2 B\right ) \tan ^2(c+d x)\right ) \, dx\\ &=\left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) x+\frac{b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac{b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac{b B (a+b \tan (c+d x))^3}{3 d}+\left (a^4 A\right ) \int \cot (c+d x) \, dx+\left (b \left (6 a^2 A b-A b^3+4 a^3 B-4 a b^2 B\right )\right ) \int \tan (c+d x) \, dx\\ &=\left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) x-\frac{b \left (6 a^2 A b-A b^3+4 a^3 B-4 a b^2 B\right ) \log (\cos (c+d x))}{d}+\frac{a^4 A \log (\sin (c+d x))}{d}+\frac{b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac{b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac{b B (a+b \tan (c+d x))^3}{3 d}\\ \end{align*}
Mathematica [C] time = 1.39383, size = 149, normalized size = 0.87 \[ \frac{6 b^2 \left (3 a^2 B+3 a A b-b^2 B\right ) \tan (c+d x)+6 a^4 A \log (\tan (c+d x))+3 b (2 a B+A b) (a+b \tan (c+d x))^2-3 (a+i b)^4 (A+i B) \log (-\tan (c+d x)+i)-3 (a-i b)^4 (A-i B) \log (\tan (c+d x)+i)+2 b B (a+b \tan (c+d x))^3}{6 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.089, size = 277, normalized size = 1.6 \begin{align*}{\frac{A{b}^{4} \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{2\,d}}+{\frac{A{b}^{4}\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}}+{\frac{B \left ( \tan \left ( dx+c \right ) \right ) ^{3}{b}^{4}}{3\,d}}-{\frac{B{b}^{4}\tan \left ( dx+c \right ) }{d}}+B{b}^{4}x+{\frac{B{b}^{4}c}{d}}-4\,Aa{b}^{3}x+4\,{\frac{Aa{b}^{3}\tan \left ( dx+c \right ) }{d}}-4\,{\frac{Aa{b}^{3}c}{d}}+2\,{\frac{Ba{b}^{3} \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{d}}+4\,{\frac{Ba{b}^{3}\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}}-6\,{\frac{A{a}^{2}{b}^{2}\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}}-6\,B{a}^{2}{b}^{2}x+6\,{\frac{B{a}^{2}{b}^{2}\tan \left ( dx+c \right ) }{d}}-6\,{\frac{B{a}^{2}{b}^{2}c}{d}}+4\,Ax{a}^{3}b+4\,{\frac{A{a}^{3}bc}{d}}-4\,{\frac{B{a}^{3}b\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}}+{\frac{A{a}^{4}\ln \left ( \sin \left ( dx+c \right ) \right ) }{d}}+B{a}^{4}x+{\frac{B{a}^{4}c}{d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.48472, size = 236, normalized size = 1.37 \begin{align*} \frac{2 \, B b^{4} \tan \left (d x + c\right )^{3} + 6 \, A a^{4} \log \left (\tan \left (d x + c\right )\right ) + 3 \,{\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )^{2} + 6 \,{\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )}{\left (d x + c\right )} - 3 \,{\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \,{\left (6 \, B a^{2} b^{2} + 4 \, A a b^{3} - B b^{4}\right )} \tan \left (d x + c\right )}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.36052, size = 423, normalized size = 2.46 \begin{align*} \frac{2 \, B b^{4} \tan \left (d x + c\right )^{3} + 3 \, A a^{4} \log \left (\frac{\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \,{\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} d x + 3 \,{\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )^{2} - 3 \,{\left (4 \, B a^{3} b + 6 \, A a^{2} b^{2} - 4 \, B a b^{3} - A b^{4}\right )} \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \,{\left (6 \, B a^{2} b^{2} + 4 \, A a b^{3} - B b^{4}\right )} \tan \left (d x + c\right )}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 4.89496, size = 291, normalized size = 1.69 \begin{align*} \begin{cases} - \frac{A a^{4} \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{A a^{4} \log{\left (\tan{\left (c + d x \right )} \right )}}{d} + 4 A a^{3} b x + \frac{3 A a^{2} b^{2} \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - 4 A a b^{3} x + \frac{4 A a b^{3} \tan{\left (c + d x \right )}}{d} - \frac{A b^{4} \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{A b^{4} \tan ^{2}{\left (c + d x \right )}}{2 d} + B a^{4} x + \frac{2 B a^{3} b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - 6 B a^{2} b^{2} x + \frac{6 B a^{2} b^{2} \tan{\left (c + d x \right )}}{d} - \frac{2 B a b^{3} \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac{2 B a b^{3} \tan ^{2}{\left (c + d x \right )}}{d} + B b^{4} x + \frac{B b^{4} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac{B b^{4} \tan{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (A + B \tan{\left (c \right )}\right ) \left (a + b \tan{\left (c \right )}\right )^{4} \cot{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 2.6021, size = 258, normalized size = 1.5 \begin{align*} \frac{2 \, B b^{4} \tan \left (d x + c\right )^{3} + 12 \, B a b^{3} \tan \left (d x + c\right )^{2} + 3 \, A b^{4} \tan \left (d x + c\right )^{2} + 6 \, A a^{4} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) + 36 \, B a^{2} b^{2} \tan \left (d x + c\right ) + 24 \, A a b^{3} \tan \left (d x + c\right ) - 6 \, B b^{4} \tan \left (d x + c\right ) + 6 \,{\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )}{\left (d x + c\right )} - 3 \,{\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]